<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;

class StudentCourseModel extends BaseModel
{
    use HasFactory;
    use SoftDeletes;
    protected $table = 'student_course';
    protected $primaryKey = 'id';
    protected $fillable = [
        'company_id',
        'student_id',
        'student_name',
        'course_id',
        'course_name',
        'course_num',
        'send_num',
        'learned_num',
        'pay_type',
        'pay_status',
        'pay_price',
        'pay_time',
        'pay_no',
        'total_price',
        'discount_price',
        'finish',
        'note',
        'deleted_note',
        'valid_begin_date',
        'valid_end_date',
        'valid_time_len'
    ];

    public function course()
    {
        return $this->hasOne(CourseModel::class, 'id', 'course_id')->select('id', 'name', 'img');
    }
}
